import request from "../request";
const Goods_USER = "/goods";
const LIST_PATh = "categories"
const ADD_PATH = 'goods'
import qs from "querystring";

//商品列表
function goodsuser(params) {
  return request({
    method: "get",
    url: Goods_USER + "?" + qs.stringify(params),
  });
}
//商品分类列表
function cateList(params) {
  return request({
    url: LIST_PATh + "?" + qs.stringify(params),
    method: "get",
  })
}
//添加
function addList(obj) {
  return request({
    url: ADD_PATH,
    method: 'post',
    data: obj
  })
}
//删除
function delList(id) {
  return request({
    url: `goods/${id}`,
    method: 'delete',
  })
}

//根据id查询商品
function idList(id) {
  return request({
    url: `goods/${id}`,
    method: 'get',
  })
}
//编辑
function editList(id,obj) {
  return request({
    url: `goods/${id}`,
    method: 'put',
    data:obj
  })
}

export { goodsuser, cateList, addList, delList, idList, editList };